CloudFederationApi: access-token lifecycle fixes#61889
Draft
mickenordin wants to merge 3 commits into
Draft
Conversation
9c60ec5 to
83513fa
Compare
The cleanup job only deleted ocm_token_map rows, orphaning the temporary access tokens in oc_authtoken so they accumulated indefinitely. Revoke each expired access token before dropping its mapping. Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: Micke Nordin <kano@sunet.se>
…s removed Extract the revoke-then-delete logic into OcmTokenService and add a ShareDeletedEvent listener that revokes the access tokens exchanged from a removed share's secret, drops their ocm_token_map rows, and invalidates the refresh token — instead of leaving them until the expiry job, which can no longer find them once the share is gone. Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: Micke Nordin <kano@sunet.se>
…oken A refresh token may back several concurrent access tokens. E.g. in a multi protocol share for a webapp the webdav mount and the webapp launcher exchange the same secret, so the exchange must not assume a single mapping. Drop the revoke-previous step and the findByRefreshToken (findEntity) lookup, which threw MultipleObjectsReturnedException once more than one access token existed. Expiry and unshare cleanup revoke the tokens instead. Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: Micke Nordin <kano@sunet.se>
83513fa to
60f962d
Compare
Contributor
Author
|
I was able to verify this in my testrig: Then after unshare: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three lifecycle bugs in the OCM access-token exchange
A refresh token (the OCM sharedSecret) can back several concurrent access tokens.
CleanupExpiredOcmTokensJobonly deletedocm_token_mapnot the access tokens inoc_authtokenA new
ShareDeletedEventlistener revokes all access tokens exchanged from the removed share's secretChecklist
AI (if applicable)